<!DOCTYPE html>
<html lang="en">
	<head>
		<include file="Index/head" />
	</head>

	<body>
		<include file="Index/header" />

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<include file="Index/menu" />
				
				<div class="main-content">
					<include file="Index/nav" />

					<div class="page-content">
						
							<!-- /**
							 * 右侧页面begin
       */ -->                                              
								<div class="row">
									<div class="col-xs-12">
										<div class="table-header">
											产品列表
										</div>
                                                                            
                                                                            

										<div class="table-responsive">
                                                                                    
                                                                                        
											<div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
											<div class="row">
											<div class="col-sm-6">
											<div id="sample-table-2_length" class="dataTables_length">
											<!-- <label>Display 
											<select size="1" name="sample-table-2_length" aria-controls="sample-table-2">
											<option value="10" selected="selected">10</option><option value="25">25</option><option value="50">50</option>
											<option value="100">100</option>
											</select> records
											</label> -->
											</div>
											</div>
											<div class="col-sm-6" style="margin-bottom:-20px;">
											<div class="dataTables_filter" id="sample-table-2_filter">
											
											</div>
											</div>
											</div>
                                                                                            <div class="row">
									<div class="col-xs-12">
                                                                            <form action="{:U('Admin/Tag/tag_product_search_result')}" method="get">
                                                                                <input name="search" value="1" type="hidden" />
                                                                                <input name="tagid" value="{$tagid}" type="hidden" />
                                                                                <div class="form-group">
                                                                                    
                                                                                        <label class="col-sm-3" for="form-field-select-1">分类</label>
                                                                                        <div class="col-sm-9">
                                                                                            <select name="sortname" class=" form-control" id="form-field-select-1">
                                                                                                <option value="乳制品">乳制品</option>
                                                                                                <option value="冷冻饮品">冷冻饮品</option>
                                                                                                <option value="水产及水产制品">水产及水产制品</option>
                                                                                                <option value="水产品及水产制品">水产品及水产制品</option>
                                                                                                <option value="水果及其制品">水果及其制品</option>
                                                                                                <option value="炒货食品及坚果制品">炒货食品及坚果制品</option>
                                                                                                <option value="焙烤食品">焙烤食品</option>
                                                                                                <option value="特殊膳食食品">特殊膳食食品</option>
                                                                                                <option value="粮食及粮食制品">粮食及粮食制品</option>
                                                                                                <option value="糖果及可可制品">糖果及可可制品</option>
                                                                                                <option value="罐头">罐头</option>
                                                                                                <option value="肉及肉制品">肉及肉制品</option>
                                                                                                <option value="茶叶及其相关制品、咖啡">茶叶及其相关制品、咖啡</option>
                                                                                                <option value="蔬菜及其制品">蔬菜及其制品</option>
                                                                                                <option value="蔬菜及其制品蔬菜及其制品">蔬菜及其制品蔬菜及其制品</option>
                                                                                                <option value="薯类及膨化食品">薯类及膨化食品</option>
                                                                                                <option value="蛋及蛋制品">蛋及蛋制品</option>
                                                                                                <option value="蜂产品">蜂产品</option>
                                                                                                <option value="调味品">调味品</option>
                                                                                                <option value="豆类">豆类</option>
                                                                                                <option value="豆类及其制品">豆类及其制品</option>
                                                                                                <option value="豆类及其制品及其制品">豆类及其制品及其制品</option>
                                                                                                <option value="酒类">酒类</option>
                                                                                                <option value="食品添加剂">食品添加剂</option>
                                                                                                <option value="食用油、油脂及其制品">食用油、油脂及其制品</option>
                                                                                                <option value="食糖">食糖</option>
                                                                                                <option value="饮料">饮料</option>
                                                                                                
                                                                                        </select>
                                                                                        </div>
                                                                                        
                                                                                
                                                                                </div>
                                                                                <br/><br/>
                                                                                <div class="form-group">
                                                                                        <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 关键字 </label>

                                                                                        <div class="col-sm-9">
                                                                                                <input name="keyword" type="text" id="form-field-1" placeholder="产品关键字" class="col-xs-10 col-sm-5">
                                                                                        </div>
                                                                                </div>
                                                                                <br/><br/>
                                                                                <div class="form-group">
                                                                                    
                                                                                        <label class="col-sm-3" for="form-field-select-1">分类</label>
                                                                                        <div class="col-sm-9">
                                                                                            <button class="btn btn-info" type="submit">
												<i class="icon-ok bigger-110"></i>
												提交
											</button>
                                                                                        </div>
                                                                                        
                                                                                
                                                                                </div>
                                                                                
                                                                                
                                                                            </form>
                                                                        </div>
									</div>
                                                                                            <br/>
                                                                                             <form action="__SELF__" method="POST">
											<table id="sample-table-2" class="table table-striped table-bordered table-hover dataTable" aria-describedby="sample-table-2_info">
												<thead>
													<tr role="row"><th  role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Domain: activate to sort column ascending" style="width: 100px;">ID</th>
                                                                                                            <th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Price: activate to sort column ascending" style="width: 150px;">产品名</th>
                                                                                                            <th  role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending" style="width: 150px;">公司</th>
														<th class="hidden-480" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending" style="width: 150px;">所属分类</th>
														<th class="" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Update: activate to sort column ascending" style="width: 200px;">
															<i class="icon-address bigger-110 hidden-480"></i>
															抽检地区
														</th>
                                                                                                                <th class="" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Update: activate to sort column ascending" style="width: 200px;">
															是否合格
														</th>
                                                                                                                <th class="" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Update: activate to sort column ascending" style="width: 200px;">
															生产日期
														</th>
                                                                                                                <th class="" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Update: activate to sort column ascending" style="width: 200px;">
															检测日期
														</th>
														

														<th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label="" style="width: 150px;">操作</th></tr>
												</thead>
											<tbody role="alert" aria-live="polite" aria-relevant="all">
											<!-- 循环开始出 -->
											<volist name="list" id="vo">
											<tr class="odd">
												<td class=" ">
                                                                                                    <input type="hidden" value="{$vo.id}" name="pid[]" />
                                                                                                    {$vo.id}</td>
												<td class=" ">{$vo.product_name}</td>
												<td class=" ">{$vo.firm_name}</td>
												<td class=" ">{$vo.category}</td>
												<td class=" ">{$vo.province}</td>
                                                                                                <td class=" ">
                                                                                        <if condition='$vo.qualified eq 1'>
                                                                                            合格
                                                                                            <else/>
                                                                                           <span class="label label-sm label-warning">不合格</span>
                                                                                        </if>
                                                                                                </td>
                                                                                                <td class=" ">{$vo.cdate}</td>
                                                                                                <td class=" ">{$vo.notification_number}</td>
												<td class=" ">
													<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
														

														<a class="red del_product" href="#">
															<i class="icon-trash bigger-130" title="删除" ></i>
														</a>
                                                                                                            <a class="red add_product" href="#" data-id='{$vo.id}'>
															<i class="icon-heart bigger-130" title="添加" ></i>
														</a>
													</div>

													<div class="visible-xs visible-sm hidden-md hidden-lg">
														<div class="inline position-relative">
															<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																<i class="icon-caret-down icon-only bigger-120"></i>
															</button>

															<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																<li>
																	<a href="#" class="tooltip-info" data-rel="tooltip" data-original-title="View">
																		<span class="blue">
																			<i class="icon-zoom-in bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="#" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																		<span class="green">
																			<i class="icon-edit bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="#" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																		<span class="red">
																			<i class="icon-trash bigger-120"></i>
																		</span>
																	</a>
																</li>
															</ul>
														</div>
													</div>
												</td>
											</tr>
											</volist>
											<!-- 循环输出结束处 -->
											</tbody>
											</table>
                                                                                            <input type="hidden" name ='tagid' id='tagid' value="{$tagid}" />
													<div class="row">
														<div class="col-sm-6">
                                                                                                                    <div class="dataTables_info" id="sample-table-2_info">
                                                                                                                        <button class="btn btn-success" type='submit'>添加所有</button>
                                                                                                                    </div>
														</div>
														<div class="col-sm-6">
															<div class="dataTables_paginate paging_bootstrap">
																<ul class="pagination">
																	
																</ul>
															</div>
														</div>
													</div>
                                                                                             </form>
										</div>
									</div>
								</div>

							<!-- /**
							 * 右侧页面end
							 */ -->
					</div><!-- /.page-content -->
				</div>

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<include file="Index/footer" />
		<script type="text/javascript">
//		function del_product(id)
//		{
//			var r= confirm('确定删除?');
//			if(r)
//			{
//				console.log($(this).parent('.odd').html());
//			}
//			else
//			{
//				return false;
//			}
//		}
                
                $(".del_product").on("click",function(){
                    console.log($(this).parent().parent().parent().remove());
                });
                
                $(".add_product").on("click",function(){
                    var tagid = $("#tagid").val();
                    var id = $(this).attr('data-id');
                    console.log(tagid);
//                    console.log($(this).parent().parent().parent().remove());
                    $.ajax({
                            type:'GET',
                            url:"{:U('Admin/Tag/add_product_to_tagid')}",
                            data:"pid="+id+"&tagid="+tagid,
                            dataType:'json',
                            success:function(data){
//                                alert(data);
                                    if(data===1){

                                            alert('添加成功!');
                                            
                                    }else{

                                            alert('添加失败!');
                                    }
                            }
                    });
                });
		</script>
	</body>
</html>
